package chap_7_Single_Dimensional_Arrays;

import java.util.Scanner;

public class Listing_7_1_AnalyzeNumbers {
	public static void main(String[] args) {
		int[] myArray = new int[10];
		System.out.println("Please enter 10 numbers: ");
		Scanner scanner = new Scanner(System.in);
		int sum = 0;
		for(int i = 0; i < 10; i++) 
		{
			myArray[i] = scanner.nextInt();			
			sum += myArray[i];
		}
		System.out.println("\nSum = " + sum);
		double average = (double)sum / myArray.length;
		System.out.println("Average = " + average);
		int numberLargerThanAverage = 0;
		
		for(int i = 0; i < 10; i++)
		{
			System.out.print("myArray[" + i + "] = " + myArray[i] + ", ");
			if (myArray[i] > average) {
				numberLargerThanAverage++;
			}			
		}
		System.out.println("\nThe number of items grater than the average: " + numberLargerThanAverage);
		scanner.close();		
	}
}
